﻿using System;
using System.Collections.Generic;
using System.Text;
namespace OznerOA.Common
{
    /// <summary>
    /// Config模型类
    /// </summary>
    public class ConfigModel
    {
        #region OZNER站点的SHOE_MENU
        private static string SHOE_MENU_KEY = "SHOW_MENU";
        public static string SHOW_MENU
        {
            get { return ConfigUtils.GetValue(SHOE_MENU_KEY); }
            set { ConfigUtils.SetValue(SHOE_MENU_KEY, value); }
        }
        #endregion
        #region OZNER站点的SHOW_CONSOLE
        private static string SHOW_CONSOLE_KEY = "SHOW_CONSOLE";
        public static string SHOW_CONSOLE
        {
            get { return ConfigUtils.GetValue(SHOW_CONSOLE_KEY).ToUpper(); }
            set { ConfigUtils.SetValue(SHOW_CONSOLE_KEY, value.ToUpper()); }
        }
        #endregion
        #region OZNER站点的THEME
        private static string THEME_KEY = "THEME";
        public static string THEME
        {
            get { return ConfigUtils.GetValue(THEME_KEY); }
            set { ConfigUtils.SetValue(THEME_KEY, value); }
        }
        #endregion
        #region OZNER站点的AUTO_LOGIN
        private static string AUTO_LOGIN_KEY = "AUTO_LOGIN";
        public static bool AutoLogin
        {
            get { return bool.Parse(ConfigUtils.GetValue(AUTO_LOGIN_KEY).ToLower()); }
            set { ConfigUtils.SetValue(AUTO_LOGIN_KEY, value.ToString().ToUpper()); }
        }
        #endregion
        #region OZNER站点的pw
        private static string PASSWORD_KEY = "PASSWORD";
        public static string Password
        {
            get { return ConfigUtils.GetValue(PASSWORD_KEY); }
            set { ConfigUtils.SetValue(PASSWORD_KEY, value); }
        }
        #endregion
        #region OZNER站点的un
        private static string USER_NAME_KEY = "ACCOUNT";
        public static string UserName
        {
            get { return ConfigUtils.GetValue(USER_NAME_KEY); }
            set { ConfigUtils.SetValue(USER_NAME_KEY, value); }
        }
        #endregion
        #region OZNER站点的Cookies
        public static string Cookies { get; set; }
        #endregion
        #region OZNER站点的地址
        private static string OZNER_BASE_URL_KEY = "OZNEROA_BASE_URL";
        private static string baseUrl = null;
        public static string BaseUrl
        {
            get
            {
                if (string.IsNullOrEmpty(baseUrl))
                {
                    baseUrl = ConfigUtils.GetValue(OZNER_BASE_URL_KEY);
                }
                return baseUrl;

            }
            set { ConfigUtils.SetValue(OZNER_BASE_URL_KEY, value); }
        }
        #endregion
        #region OZNER系统中文名
        private static string SYSTEM_NAME_KEY = "SYSTEM_NAME";
        public static string SystemName
        {
            get { return ConfigUtils.GetValue(SYSTEM_NAME_KEY); }
            set { ConfigUtils.SetValue(SYSTEM_NAME_KEY, value); }
        }
        #endregion
        #region OZNER系统登录页面地址
        private static string OZNER_LOGIN_URL = "OZNEROA_LOGIN_URL";
        public static string LoginUrl
        {
            get { return ConfigUtils.GetValue(OZNER_LOGIN_URL); }
            set { ConfigUtils.SetValue(OZNER_LOGIN_URL, value); }
        }
        #endregion
        #region WORKFLOW_REQUEST_FRMREQUESTVIEW_REFRESHTIMES
        private static string WORKFLOW_REQUEST_FRMREQUESTVIEW_REFRESHTIMES = "Workflow.Request.FrmRequestView.RefreshTimes";
        /// <summary>
        /// 自动刷新频率
        /// </summary>
        public static string WorkflowRequestFrmRequestViewRefreshTimes
        {
            get { return ConfigUtils.GetValue(WORKFLOW_REQUEST_FRMREQUESTVIEW_REFRESHTIMES); }
            set { ConfigUtils.SetValue(WORKFLOW_REQUEST_FRMREQUESTVIEW_REFRESHTIMES, value); }
        }
        #endregion
        #region OZNER系统登录页面地址
        private static string CONSOLE_SHOW_TYPE = "Console.ShowType";
        private static int _consoleShowType = -1;
        /// <summary>
        /// 自动刷新频率
        /// </summary>
        public static int ConsoleShowType
        {
            get
            {
                if (_consoleShowType < 0)
                {
                    _consoleShowType = int.Parse(ConfigUtils.GetValue(CONSOLE_SHOW_TYPE));
                }
                return _consoleShowType;
            }
            set
            {
                _consoleShowType = value;
                ConfigUtils.SetValue(CONSOLE_SHOW_TYPE, value + "");
            }
        }
        #endregion
    }
}
